Skip to content

Conversation

@GaryJones
Copy link
Contributor

Summary

Posts published from custom statuses like "Pitch" or "Assigned" were retaining their original creation date rather than updating to the actual publication time. This caused:

  • Posts appearing with stale dates in archives/feeds
  • SEO issues when dates are in URLs
  • Excessive redirects when editors manually correct dates (e.g., with Yoast Pro)

WordPress core updates post_date when publishing from 'draft' or 'pending', but doesn't know about Edit Flow's custom statuses. This fix adds that same behavior for custom statuses.

Changes

  • Added update_post_date_on_publish_from_custom_status() method that hooks into wp_insert_post_data
  • When transitioning to 'publish' from an unpublished custom status with empty post_date_gmt, the post_date is updated to current time
  • Scheduled posts and explicitly set dates are still respected
  • Added comprehensive test coverage with 6 test cases

Test plan

  • All 6 new tests pass
  • PHP linting passes
  • Pre-existing test failures are unrelated to this change (verified by testing without the fix)
  • Manual test: Create a post with "Pitch" status, wait, then publish - date should update to publish time
  • Manual test: Schedule a post for future - date should be preserved when it auto-publishes
  • Manual test: Explicitly set a past date when publishing - that date should be respected

Fixes #750

🤖 Generated with Claude Code

Posts published from custom statuses like "Pitch" or "Assigned" were
retaining their original creation date rather than updating to the
actual publication time. This caused SEO issues when dates appear in
URLs and created unnecessary redirects.

WordPress core updates post_date when publishing from 'draft' or
'pending', but doesn't know about Edit Flow's custom statuses. This fix
adds that same behavior for custom statuses by hooking into
wp_insert_post_data and updating the date when transitioning to
'publish' from any unpublished status with an empty post_date_gmt.

Scheduled posts and explicitly set dates are still respected.

Fixes #750

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@GaryJones GaryJones requested a review from a team as a code owner December 21, 2025 23:36
@GaryJones GaryJones self-assigned this Dec 21, 2025
@GaryJones GaryJones added this to the Next (minor) milestone Dec 21, 2025
@GaryJones GaryJones merged commit 68cc763 into develop Dec 21, 2025
13 of 14 checks passed
@GaryJones GaryJones deleted the fix/750-publish-date-from-custom-status branch December 21, 2025 23:43
@GaryJones GaryJones mentioned this pull request Jan 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Posts are published with the date of first saving

2 participants